Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.3
How is the site context determined in Sitecore V5?

The Sitecore web.config file includes a list of served web sites listed in the <sites> section.  Each site is described with a <site> tag which includes a number of attributes.  Sitecore determines the site context based on the incoming URL and the following two attributes:

Sitecore determines the site the following way:

  1. For each site in the <sites> list 
    1. Sitecore compares the hostName attribute (which may include wildcards) to the incoming url
    2. If the hostName attribute matches or the hostName attribute is empty, Sitecore compares the virtualFolder attribute.
    3. If both these two parameters match the incoming url, the site is used as context site.

Note that Sitecore checks for sites in the order in which they are included in the list.  Thus, the "website" site should most likely be one of the last entries in the list, because it is the most general entry and matches all URLs in the site.